from google.appengine.ext import db
from google.appengine.api import images

#DB Models
class Member(db.Model):
    name                = db.StringProperty()
    salt                = db.StringProperty()
    password            = db.StringProperty()
    fullname            = db.StringProperty()
    email               = db.StringProperty()
    emailisvalid        = db.BooleanProperty()
    emailvalidationcode = db.StringProperty()
    timeadded           = db.DateTimeProperty(auto_now_add = True)

class LoginRecord(db.Model):
    code      = db.StringProperty()
    member    = db.ReferenceProperty(Member)
    timeadded = db.DateTimeProperty(auto_now_add = True)
    browser   = db.StringProperty()
    ip        = db.StringProperty()

class Photo(db.Model):
    member    = db.ReferenceProperty(Member)
    filename  = db.StringProperty()
    content   = db.BlobProperty()
    thumb     = db.BlobProperty()
    timeadded = db.DateTimeProperty(auto_now_add = True)

class PasswordResetLink(db.Model):
    member      = db.ReferenceProperty(Member)
    code        = db.StringProperty()
    alreadyused = db.BooleanProperty()
    timeadded   = db.DateTimeProperty(auto_now_add = True)

#End of DB Models
